package com.gcsoftware.configs;

/**
 * 项目常量
 * @author czp
 * date : 2018-04-10
 */
public class AppConstants {
    /**
     * ES返回字段
     */
    public enum Elasticsearch {
        /**
         * 字段
         */
        ES_SOURCE_IP("sourceIp", "源IP"),
        ES_TARGET_IP("targetIp", "目的IP"),
        ES_CREATE_TIME("createTime", "日志产生时间"),
        ES_APP_ID("appId", "应用ID"),
        ES_APP_NAME("appName", "应用名字"),
        ES_API_ID("apiId", "接口ID"),
        ES_API_NAME("apiName", "接口名字"),
        ES_TOKEN_ID("tokenId", "证书ID"),
        ES_ROLE_NAME("roleName", "角色名"),
        ES_ROLE_ID("roleId", "角色ID"),
        ES_SENSITIVE_ITEM_IDS("sensitiveItemIds", "敏感项ID列表"),
        ES_SENSITIVE_ITEM_NAMES("sensitiveItemNames", "敏感项名列表"),
        /**
         * 分组
         */
        ES_API_NAME_GROUPS("es_api_name_groups", "API分组"),
        ES_APP_NAME_GROUPS("es_app_name_groups", "APP分组"),
        ES_TIME_GROUPS("es_time_groups", "时间"),
        ES_ITEM_GROUPS("es_item_groups", "敏感项组"),
        /**
         * 分词类型
         */
        ES_MATCH_TAG("match", "分词"),
        ES_MATCH_PHRASE_TAG("match_phrase", "分词, 匹配所有字段且顺序一致"),
        ES_TERM_TAG("term", "不分词,keyword类型"),
        /**
         * 拆分标记
         */
        ES_STR_SPLIT(",", "字符串拆分标记");

        Elasticsearch(String value, String name){
            this.value = value;
            this.name = name;
        }

        private final String value;
        private final String name;

        public String getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 系统定义
     */
    public enum Sys {
        SYS_STR_SPLIT(">", "字符串拆分标记"),
        SYS_MEASURE_DAY("day", "时间度量，以天为单位"),
        SYS_MEASURE_SECOND("second", "时间度量，以秒为单位"),
        SYS_SENSITIVE_ITEM_TOP("6", "敏感项TOP值");

        Sys(String value, String name){
            this.value = value;
            this.name = name;
        }

        private final String value;
        private final String name;

        public String getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 日志标识
     */
    public enum Log {
        LOG_PREFIX("\n***************************** START *****************************\n", "日志前缀"),
        LOG_SUFFIX("\n*****************************  END  *****************************", "日志后缀");

        Log(String value, String name){
            this.value = value;
            this.name = name;
        }

        private final String value;
        private final String name;

        public String getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }
}
